home *** CD-ROM | disk | FTP | other *** search
- package javax.swing.plaf.basic;
-
- import java.awt.Dimension;
- import java.awt.Rectangle;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import javax.swing.JComponent;
-
- class BasicTreeUI$ScrollAction implements ActionListener {
- private JComponent component;
- private int direction;
- private int amount;
-
- public BasicTreeUI$ScrollAction(JComponent var1, int var2, int var3) {
- this.component = var1;
- this.direction = var2;
- this.amount = var3;
- }
-
- public void actionPerformed(ActionEvent var1) {
- Rectangle var2 = this.component.getVisibleRect();
- Dimension var3 = this.component.getSize();
- if (this.direction == 0) {
- var2.x += this.amount;
- var2.x = Math.max(0, var2.x);
- var2.x = Math.min(Math.max(0, var3.width - var2.width), var2.x);
- } else {
- var2.y += this.amount;
- var2.y = Math.max(0, var2.y);
- var2.y = Math.min(Math.max(0, var3.width - var2.height), var2.y);
- }
-
- this.component.scrollRectToVisible(var2);
- }
- }
-